<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // es5写法
    function Phone(name, brand, price) {
        this.name = name;
        this.brand = brand;
        this.price = price;
    }
    Phone.prototype.call = function () {
        console.log("使用华为手机打电话");
    }
    Phone.prototype.size = "5.5英寸"
    let Huawei = new Phone("华为", "华为", 5999);
    console.log(Huawei.size);


    class Mobile {
        static name = "手机";
        static size = "5.5英寸"
        static changeName(name) {
            this.name = name;
        }
        call() {
            return `使用手机打电话`;
        }
    }
    let nokia = new Mobile();
    // 类的静态属性属于类本身，而不是类的实例
    console.log(nokia.name, Mobile.name, Mobile.size);

</script>

</html>